/** \file FilterClipping.h
    \author belot.nicolas
    Filter to handle hard and soft clipping
    User should use Filter that inherit this one.*/

#ifndef FILTERCLIPPING_H
#define FILTERCLIPPING_H 1

#include "Filter.h"
#include "FilterEqualizer.h"

namespace libtrckr {

class FilterClipping : public Filter {
/** \class libtrckr::FilterClipping
    \brief Filter that handle hard (distorsion) and soft (overdrive) clipping
	\~french  Disto et overdrive:
	à la base c'est gros Gain et Equalizer, Compression, Gain.
	il y a plusieur parametre :
	- EQ
	- preGain
	- Seuil de compression
	- Ratio de compression
	- postGain
	- Attenuator.
	\~ Distorsion & Overdrive
	Basically, it's big gain and Equalization, Compression and then gain.
	There's many parameters :
	- EQ
	- preGain
	- Compression Floor
	- Compression Ratio
	- postGain
	- and why not Attenuator.
	*/
	public:
	/** Contructor */
	FilterClipping();
	/**Copy Contructor */
	FilterClipping(const FilterClipping&);
	/** Tune the filter.
	\param conf an DynArray of int, 0 => the double of the size of the Equalizer 
	from 1 to conf[0] (size) the equalizer interleaved data gain, frequancy
	size+1 => pregain
	size+2 => compression floor
	size+3 => compression ratio (0 for hardclipping)
	size+4 => postGain
	size+5 => Samplerate
	*/
	void Tune(DynArray<int>);
	/** do nothing */
	void Init();

	Buffer& Preview(Buffer&);
	double *Preview(double*,int);
	Buffer& Execution(Buffer&);
	double *Execution(double*,int);
	string HowToTune();
	private :
	/*double *eqx;
	double *eqy;
	uint nx;*/
	FilterEqualizer EQ;
	double preGain;
	double floor;
	double ratio;//0 min hard clipping
	double postGain;


};

}
#endif

